#ifndef OGREAPPLICATION_H
#define OGREAPPLICATION_H

#include "trackball.h"
#include <Ogre.h>
#include <OgreEventListeners.h>
#include <OgreKeyEvent.h>
#include <CEGUI/CEGUISystem.h>
#include <OgreCEGUIRenderer.h>

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Interface of OgreApplication
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class OgreApplication : public Ogre::KeyListener, public Ogre::FrameListener
{
public:
    OgreApplication(Ogre::String name="VisageFS");
    virtual ~OgreApplication();
    void addResourceLocationFrom(const Ogre::String& fileName);
    virtual void create(const Ogre::String& pluginsFileName,
                        const Ogre::String& configFileName,
                        const Ogre::String& logFileName,
                        Ogre::SceneType sceneType);
    void run();

    virtual void keyClicked(Ogre::KeyEvent *e);
    virtual void keyPressed(Ogre::KeyEvent *e);
    virtual void keyReleased(Ogre::KeyEvent *e);
    virtual bool frameStarted(const Ogre::FrameEvent& evt);
    virtual bool frameEnded(const Ogre::FrameEvent& evt);
protected:
    virtual void init();
    void requestQuit();
    Ogre::StringVector        mResourcesFileNames;
    Ogre::String              mName;
    Ogre::Root*               mRoot;
    Ogre::RenderWindow*       mWindow;
    Ogre::SceneManager*       mSceneManager;
    Ogre::Camera*             mCamera;
    Ogre::Viewport*           mViewport;
    Ogre::EventProcessor*     mEventProcessor;
    CEGUI::OgreCEGUIRenderer* mGUIRenderer;
    CEGUI::System*            mGUISystem;
    Trackball*                mTrackball;
    Ogre::Overlay*            mDebugPanelOverlay;
    Ogre::Vector3             move;
    int                       moveRootNode;
protected:
    bool                      mQuitRequested;
};

#endif // OGREAPPLICATION_H
